package mysql

import java.util.concurrent.Executors

/**
  *
  * 描述:
  *
  * @author hz.lei
  * @date 2018年03月28日 下午9:05
  */
object Test {


  def main(args: Array[String]): Unit = {

    val test1 = new MysqlLockTest("test1")
    val test2 = new MysqlLockTest("test2")
    val test3 = new MysqlLockTest("test3")

    val executor = Executors.newFixedThreadPool(4)

    new Thread( ()=> test1.business() ).start()

    while (true) {
      Thread.sleep(5000)
      println("=======")
      executor.execute(() => {
        test1.test()
      })

      executor.execute(() => {
        test2.test()
      })

      executor.execute(() => {
        test3.test()
      })

    }
  }


}
